home *** CD-ROM | disk | FTP | other *** search
/ bioinformatics.org / bioinformatics.org_software.tar / www.bioinformatics.org / download / ecell2 / ecell220setup.exe / {app} / standard / SRCJ / ExtensionFilter.java < prev    next >
Text File  |  2002-05-13  |  1KB  |  59 lines

  1. /**
  2.  * title:     ExtensionFilter class (ExtensionFilter.java)<p>
  3.  * description  : Controller Panel class <p>
  4.  * Copyright (C) 1996-2001 Keio University <p>
  5.  * Copyright (C) 1998-2001 Japan Science and Technology Corporation (JST)<p>
  6.  *               GNU General Public Licence <p>
  7.  * Division:     Mitui Knowledge Industry Co. Ltd. Bioscience division <p>
  8.  * Version :     $Id: ExtensionFilter.java,v 1.4 2002/05/13 00:23:04 ota Exp $ <p>
  9.  */
  10.  
  11.  
  12. package ecell;
  13.  
  14. import java.io.*;
  15.  
  16.  
  17. public class ExtensionFilter implements FilenameFilter
  18. {
  19.     private String extension = "";
  20.     
  21.     private String path = ".";
  22.     
  23.     private File f = null;
  24.     
  25.     
  26.     
  27.     public ExtensionFilter( String path, String ext )
  28.     {
  29.         if( path != null && !path.equals( "" ) )
  30.         {
  31.             this.path = path;
  32.         }
  33.         this.f = new File( this.path );
  34.         
  35.         this.setExtension( ext );
  36.     }
  37.     
  38.     public String[] list()
  39.     {
  40.         return f.list( this );
  41.     }
  42.     
  43.     public synchronized boolean accept( File dir, String name )
  44.     {
  45.         return name.endsWith( this.extension );
  46.     }
  47.     
  48.     public String getExtension()
  49.     {
  50.         return extension;
  51.     }
  52.     
  53.     public void setExtension( String ext )
  54.     {
  55.         this.extension = ext;
  56.     }
  57. }
  58.  
  59.